package com.safeluck.scannerqcr.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.safeluck.scannerqcr.R;
import com.safeluck.scannerqcr.adapter.WechatPagerFragmentAdapter;
import com.safeluck.scannerqcr.fragment.pager.DemoFragment;

/**
 * ScannerQCR
 * Created by lzw on 2017/11/28. 17:18:02
 * 邮箱：632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */

public class WechatSecondTabFragment extends BaseMainFragment{

    private TabLayout mTabLayout;
    private Toolbar mToobar;
    private ViewPager vp;


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.wechat_fragment_second_tab,container,false);
        initView(view);
        return view;
    }

    public static WechatSecondTabFragment newInstance(){
        Bundle bundle = new Bundle();
        WechatSecondTabFragment wechatFirstTabFragment = new WechatSecondTabFragment();
        wechatFirstTabFragment.setArguments(bundle);
        return wechatFirstTabFragment;
    }

    private void initView(View view) {
        mToobar = view.findViewById(R.id.toolbar);
        mToobar.setTitle("发现");

        mTabLayout = view.findViewById(R.id.tab);
        mTabLayout.addTab(mTabLayout.newTab());
        mTabLayout.addTab(mTabLayout.newTab());

        vp = view.findViewById(R.id.vp);

    }

    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
        super.onLazyInitView(savedInstanceState);
        vp.setAdapter(new WechatPagerFragmentAdapter(getChildFragmentManager(),"全部","更多"));
        mTabLayout.setupWithViewPager(vp);
    }


}
